package com.qhx.backme.controller;

import com.qhx.backme.model.Result;
import com.qhx.backme.model.to.TransactionTO;
import com.qhx.backme.service.TransactionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api( tags = "交易相关接口")
@RestController
@RequestMapping("/finance/transaction")
public class TransactionController {

    @Autowired
    TransactionService transactionService;

    @ApiOperation(value = "银行向公司交易（公司向银行提供交易存证）")
    @PostMapping("/bankToCompanyReceipt")
    public Result<String> bankToCompanyReceipt(@RequestBody TransactionTO transactionTO) {
        return transactionService.bankToCompanyReceipt(transactionTO);
    }

    @ApiOperation(value = "接收存证的公司需要给发送存证的公司转账存证对应的数额")
    @PostMapping("/companyToCompanyReceipt")
    public Result<String> companyToCompanyReceipt(@RequestBody TransactionTO transactionTO) {
        return transactionService.companyToCompanyReceipt(transactionTO);
    }

    @ApiOperation(value = "公司与银行交易(银行向公司发送凭证)")
    @PostMapping("/companyToBankReceipt")
    public Result<String> companyToBankReceipt(@RequestBody TransactionTO transactionTO) {
        return transactionService.companyToBankReceipt(transactionTO);
    }
}
